
/*
 * USBdevice.h
 *
 *  Created on: 19.02.2021
 *      Author: Yannick
 */

#ifndef USB_SRC_USBDEVICE_H_
#define USB_SRC_USBDEVICE_H_

#include "tusb.h"
#include "usb_descriptors.h"

#define USB_STRING_DESC_BUF_SIZE 32
extern uint16_t _desc_str[USB_STRING_DESC_BUF_SIZE]; // String buffer



/**
 * This class defines a usb device and implements callbacks for getting the basic
 * usb descriptors for tinyusb.
 * Different usb configurations are predefined in usb_descriptors.c
 */
typedef struct USBdevice{
	const tusb_desc_device_t* desc_device;
	const uint8_t* desc_conf; // Device configuration descriptor
	const usb_string_desc_t* string_desc;
}USBdevice;

void USBdeviceInit(const tusb_desc_device_t* deviceDesc,const uint8_t (*confDesc),const usb_string_desc_t* strings);
void USBdevice_Thread_Entry(void* parameter);

uint8_t* getUsbSerial();
const uint8_t* getUsbDeviceDesc();
uint16_t* getUsbStringDesc(uint8_t index,uint16_t langid);
const uint8_t* getUsbConfigurationDesc(uint8_t index);
const uint8_t* getUsbHidReportDesc(void);
#endif /* USB_SRC_USBDEVICE_H_ */

